<%--
  Created by IntelliJ IDEA.
  User: 黄—彦—华
  Date: 2021/10/1
  Time: 17:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
<%--    <script type="text/javascript" src="js/jquery-1.11.1.js"></script>--%>
    <script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<%--    <script type="text/javascript" src="js/bootstrap.js"></script>--%>
<%--    <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />--%>
<%--    <link rel="stylesheet" type="text/css" href="css/bootstrap-theme.css" />--%>
<%--    <link rel="stylesheet" type="text/css" href="css/mycss.css" />--%>
</head>

<%--<script type="text/javascript">
    $(function(){
        $("input[name='username']").blur(function () {
            //1.  获得value值
            var username = $(this).val();
            //2.  发送请求
            $.post("/getUser","username="+username,function (res) {
                alert("aaa");
                $("#nameMsg").html(res);
            });
        });
    });
</script>--%>
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
    $(function(){
        $("#username").blur(function () {
            //1.  获得value值
            var uanme = $(this).val();
            //2.  发送请求
            //方式一：常规操作
            /*$.ajax({
              url:"/testuname",
              data:"username="+uanme,
              type:"post",
              dataType:"text",
              success:function(res){
                $("#rs").html(res);
              }
            });*/
            //方式二：get请求
            /*$.get("/testuname","username="+uanme,function (res) {
               $("#rs").html(res);
            });*/
            //方式三：post请求
            $.post("/getUser","username="+uanme,function (res) {
                $("#rs").html(res);
            });
        });
    });
</script>
<body>
<h1>jquery_ajax.jsp</h1>
用户：<input type="text" name="username" id="username" ><span id="rs"></span>
<%--<form id="myForm" action="success.jsp" method="post" enctype="multipart/form-data">--%>
    <%--<div class="container bg-white">
        <div class="form-group media">
            <label  class="col-sm-3 control-label text-right mar-top"><b>*</b> 序号</label>
            <div class="col-sm-5 ">
                <input class="form-control" type="text" name="uid" id="uid" placeholder="请输入序号" />
            </div>
            <div class="mar-top">
                <span class="text-capitalize mar-top" id="idMsg">整数序号</span>
            </div>
        </div>
        <div class="form-group media">
            <label  class="col-sm-3 control-label text-right mar-top"><b>*</b> 用户名</label>
            <div class="col-sm-5 ">
                <input class="form-control" type="text" name="username" id="username" placeholder="请输入姓名" />
            </div>
            <div class="mar-top">
                <span class="text-capitalize mar-top" id="nameMsg">用户名长度至少4位</span>
            </div>
        </div>
        <div class="form-group media">
            <label  class="col-sm-3 control-label text-right mar-top"><b>*</b> 密 码</label>
            <div class="col-sm-5 ">
                <input class="form-control" type="password" name="password" id="password" placeholder="请输入密码" />
            </div>
            <div class="mar-top">
                <span class="text-capitalize mar-top" id="pwdMsg">密码长度至少8位</span>
            </div>
        </div>
        <div class="form-group media">
            <label class="col-sm-3 control-label text-right mar-top"><b>*</b> 电 话</label>
            <div class="col-sm-5 ">
                <input class="form-control" type="text" name="phone" id="phone" placeholder="请输入你的11位手机号码"/>
            </div>
            <div class="mar-top">
                <span class="text-capitalize mar-top" id="phonelMsg">填写你常用的手机号码</span>
            </div>
        </div>
        <div class="form-group media">
            <label  class="col-sm-3 control-label text-right mar-top"></label>
            <div class="col-sm-5 ">
                <input type="submit" value=" 登 录 " class="btn btn-info " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="reset" value=" 重 置 " class="btn btn-default " />
            </div>
        </div>
    </div>--%>
<%--</form>--%>
</body>
</html>
